home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGNG_C
/
MDSPL100.LZH
/
MDSPDEMO.C
< prev
next >
Wrap
C/C++ Source or Header
|
1987-11-16
|
6KB
|
153 lines
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <dos.h>
#include <conio.h>
#include <ctype.h>
#include "mdisplay.h"
/* This is a demonstration program that illustrates the use of */
/* the various mwin utility routines. These routines provide an */
/* interface to the secondary (mono) system monitor. Routines are */
/* available to initialize the secondary monitor, create and */
/* destroy windows, enable and disable the video signal, clear */
/* a window, scroll a window, and write to a window. The output */
/* to a window is a TTY type output. Additional routines are */
/* available to determine the output position to and change that */
/* position within a window. One default (full screen) and up to */
/* 8 program defined windows are available. */
char input;
int attrb;
int wind1,wind2,wind3,wind4;
struct mwctl mwin_status;
main(argc, argv)
int argc;
char *argv[];
{
int i,j;
if (initMono() == ERROR)
{ printf("Error in initializing mono card. ");
printf("Program being terminated.\n");
exit(); }
printf("Filling the mono screen.\n");
input = 219;
attrb = 3;
for (i=0; i < 1999; i++)
{ writeCharToMwin(0, input, attrb); }
printf("Creating first window.\n");
wind1 = createMwin(1,1,12,12);
if (wind1 == ERROR)
{ printf("Error in creating window 1. ");
printf("Program being terminated.\n");
exit(); }
writeStringToMwin(wind1, "Window number 1", attrb);
printf("Creating second window.\n");
wind2 = createMwin(1,14,60,23);
if (wind2 == ERROR)
{ printf("Error in creating window 2. ");
printf("Program being terminated.\n");
exit(); }
writeStringToMwin(wind2, "Window number 2\n", attrb);
printf("Creating third window.\n");
wind3 = createMwin(62,1,78,23);
if (wind3 == ERROR)
{ printf("Error in creating window 2. ");
printf("Program being terminated.\n");
exit(); }
writeStringToMwin(wind3, "Window number 3", attrb);
wind4 = createMwin(14,1,60,12);
if (wind4 == ERROR)
{ printf("Error in creating window 4. ");
printf("Program being terminated.\n");
exit(); }
writeStringToMwin(wind4, "Window number 4", attrb);
printf("Press any key to continue.\n");
input = getch();
disableMwin();
printf("Mono video disabled.\n");
printf("Press any key to continue.\n");
input = getch();
enableMwin();
printf("Mono video enabled.\n");
printf("Press any key to continue.\n");
input = getch();
attrb = 3;
printf("Enter text for Window 1. Press ESC to quit.\n");
input = getch();
for ( ;!eof(fileno(stdin)) & input!=27; ) /* quit on eof or ESC*/
{ writeCharToMwin(wind1, input, attrb);
input = getch();
}
attrb = 9;
printf("Enter text for Window 2. Press ESC to quit.\n");
input = getch();
for ( ;!eof(fileno(stdin)) & input!=27; ) /* quit on eof or ESC*/
{ writeCharToMwin(wind2, input, attrb);
input = getch();
}
attrb = 24;
printf("Enter text for Window 3. Press ESC to quit.\n");
input = getch();
for ( ;!eof(fileno(stdin)) & input!=27; ) /* quit on eof or ESC*/
{ writeCharToMwin(wind3, input, attrb);
input = getch();
}
attrb = 240;
printf("Enter text for Window 4. Press ESC to quit.\n");
input = getch();
for ( ;!eof(fileno(stdin)) & input!=27; ) /* quit on eof or ESC*/
{ writeCharToMwin(wind4, input, attrb);
input = getch();
}
printf("Destroying second window.\n");
if (destroyMwin(wind2) == ERROR)
{ printf("Error in destroying window 2. ");
printf("Program being terminated.\n");
exit(); }
printf("Destroying third window.\n");
if (destroyMwin(wind3) == ERROR)
{ printf("Error in destroying window 3. ");
printf("Program being terminated.\n");
exit(); }
printf("Destroying forth window.\n");
if (destroyMwin(wind4) == ERROR)
{ printf("Error in destroying window 4. ");
printf("Program being terminated.\n");
exit(); }
printf("Recreating second window.\n");
wind2 = createMwin(1,14,78,23);
if (wind2 == ERROR)
{ printf("Error in creating window 2. ");
printf("Program being terminated.\n");
exit(); }
printf("Recreating third window.\n");
wind3 = createMwin(14,1,78,12);
if (wind3 == ERROR)
{ printf("Error in creating window 3. ");
printf("Program being terminated.\n");
exit(); }
input = 219;
attrb = 3;
setMwin(0,62,13); /* Refill the background */
for (i=0; i < 17; i++)
{ writeCharToMwin(0, input, attrb); }
attrb = 3;
writeStringToMwin(wind2, "Window number 2\n", attrb);
for (i=0; i < 6; i++)
{ writeStringToMwin(wind2, "Test output to window.\n", attrb);}
if (getMwinStatus(wind2, &mwin_status) == ERROR)
{ printf("Error in window status. ");
printf("Program being terminated.\n");
exit(); }
printf("Status for window %i\n", wind2);
printf("Status for window %i\n", mwin_status.mwin);
printf(" Current line: %i\n", mwin_status.line);
printf(" Current column: %i\n", mwin_status.column);
writeStringToMwin(wind3, "Window number 3\n", attrb);
printf("Press any key to end program.\n");
input = getch();
initMono();
}